#include <gtk/gtk.h>

void ok_button_clicked(GtkWidget *self,GtkFileSelection *fs){
	printf("%s:choosed file -> %s\n",__func__,gtk_file_selection_get_filename(
		GTK_FILE_SELECTION(fs)));
}

int main(int argc,char **argv){
	gtk_init(&argc,&argv);
	GtkWidget *file_diag = gtk_file_selection_new("File selection");
	//gtk_signal_connect(GTK_OBJECT(file_diag),"destroy",G_CALLBACK(destroy),&file_diag);
	gtk_signal_connect(GTK_OBJECT(file_diag),"destroy",G_CALLBACK(gtk_main_quit),file_diag);

	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(file_diag)->ok_button),
		"clicked",G_CALLBACK(ok_button_clicked),file_diag);
	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(file_diag)->cancel_button),
		"clicked",G_CALLBACK(gtk_main_quit),GTK_OBJECT(file_diag));
	gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_diag),"penguin.png");
	gtk_widget_show(file_diag);
	gtk_main();
	return 0;
}